package com.tarena.csmall.test.spring.config;

import com.tarena.csmall.test.spring.bean.Bean01;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;

@Configuration
@ComponentScan(basePackages = {
    "com.tarena.csmall.test.spring.bean","com.tarena.csmall.test.spring.condition"})
@Import(value = {MyConfiguration02.class})
//读取外部的properties文件
@PropertySource(value = {"classpath:csmall.properties"})
@ImportResource(value = {"classpath:demo03.xml"})
public class MyConfiguration01 {
    /**
     * 通过@Bean注解的方法
     * 将方法的返回值封装到spring容器中
     * @return
     */
    @Bean
    public Bean01 bean01(){
        return new Bean01();
    }
}
